package com.mathpractise.question.generator;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;

import javax.annotation.PostConstruct;
import java.util.Map;

/**
 * 题目生成器自动配置类
 * 
 * 在应用启动时自动注册所有题目生成器
 */
@Configuration
public class QuestionGeneratorAutoConfig {
    
    @Autowired
    private QuestionGeneratorConfig questionGeneratorConfig;
    
    @Autowired
    private Map<String, QuestionGenerator> questionGeneratorMap;
    
    @PostConstruct
    public void init() {
        // 自动注册所有题目生成器
        for (QuestionGenerator generator : questionGeneratorMap.values()) {
            questionGeneratorConfig.registerGenerator(generator);
        }
    }
}